package com.example.goandroiddemo.animate;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

import com.example.goandroiddemo.R;
import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;

public class NineoldAndroidsTest extends Activity {
	private TextView mText;
	private int duration = 300;
	private AnimatorSet animSet;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.activity_nineold_android);

		mText = (TextView) findViewById(R.id.tv);

//		ObjectAnimator.ofFloat(mText, "translationY", -mText.getHeight());
		ObjectAnimator.ofFloat(mText, "rotationY", 0, -90).setDuration(1000).start();
//		ObjectAnimator.ofFloat(mText, "translationX", 0, .10f, -25,
//				.26f, 25, .42f, -25, .58f, 25, .74f, -25, .90f, 1, 0)
//				.setDuration(300).start();
//		animSet = new AnimatorSet();
//		animSet.playTogether(
//                ObjectAnimator.ofFloat(mText, "rotation", 1080,720,360,0).setDuration(duration),
//                ObjectAnimator.ofFloat(mText, "alpha", 0, 1).setDuration(duration*3/2),
//                ObjectAnimator.ofFloat(mText, "scaleX", 0.1f, 0.5f, 1).setDuration(duration),
//                ObjectAnimator.ofFloat(mText,"scaleY",0.1f,0.5f,1).setDuration(duration)
//
//        );
//		animSet.start();

		// ValueAnimator colorAnimation = ObjectAnimator.ofInt(mText,
		// "backgroundColor", /*Red*/0xFFFF8080, /*Blue*/0xFF8080FF);
		// colorAnimation.setDuration(3000);
		// colorAnimation.setEvaluator(new ArgbEvaluator());
		// colorAnimation.setRepeatCount(ValueAnimator.INFINITE);
		// colorAnimation.setRepeatMode(ValueAnimator.REVERSE);
		// colorAnimation.start();

//		AnimatorSet animationSet = new AnimatorSet();
//		animationSet.playTogether(
//				ObjectAnimator.ofFloat(mText, "rotationX", 0, 360),
//				ObjectAnimator.ofFloat(mText, "rotationY", 0, 180),
//				ObjectAnimator.ofFloat(mText, "rotation", 0, -90),
//				ObjectAnimator.ofFloat(mText, "translationX", 0, 90),
//				ObjectAnimator.ofFloat(mText, "translationY", 0, 90),
//				ObjectAnimator.ofFloat(mText, "scaleX", 1, 1.5f),
//				ObjectAnimator.ofFloat(mText, "scaleY", 1, 0.5f),
//				ObjectAnimator.ofFloat(mText, "alpha", 1, 0.25f, 1));

	}
}
